﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Windows.Media.Imaging;

namespace Internet_Cafe.App_Code
{
    public static class MethodsCollection
    {
        /// <summary>
        /// Konvertira od Bitmap objekt vo BitmapSource potreben za image kontrolite na WTF
        /// </summary>
        /// <param name="bmp">Bitmap objekt koj sto NIE go citame od Resources</param>
        /// <returns></returns>
        public static BitmapSource ConvertBitmapToBitmapSource(Bitmap bmp)
        {
            System.Windows.Media.Imaging.BitmapSource bitmap_source =
                System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(bmp.GetHbitmap(), IntPtr.Zero, System.Windows.Int32Rect.Empty, 
                                                                                    BitmapSizeOptions.FromWidthAndHeight(bmp.Width, bmp.Height));
            return bitmap_source;
        }
    }
}
